package com.project.controller;


import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;



@RestController
@RequestMapping("up")
public class UploadController {

    @PostMapping("upload")
    @ResponseBody
    public String register2(@RequestParam("file") MultipartFile mf) throws IOException {
        String fileName = mf.getOriginalFilename();
        fileName = System.currentTimeMillis() +
                fileName.substring(fileName.lastIndexOf("."));
        mf.transferTo(new File("d:/img/" + fileName));
        return fileName;
    }


}
